
		* APPENDIX 12: Did Strong Labour Partisans Follow the Party? 
		
		cd "$data"
		use "data1.dta", clear 
		
		gen labourind_force6 = .
replace labourind_force6 = 0 if pid6==0	// independent
replace labourind_force6 = 1 if partyIdStrengthW6==3 & pid6==2 // not very strong 
replace labourind_force6 = 1 if partyIdStrengthW6==2 & pid6==2 // fairly strong 
replace labourind_force6 = 2 if partyIdStrengthW6==1 & pid6==2 // very strong 



gen centerleftright = .
replace centerleftright = 0 if leftright6==1
replace centerleftright = 1 if leftright6==0
replace centerleftright = 2 if leftright6==2

label define centerleftright_labels 0"center" 1"left-wing" 2"right-wing"
label values centerleftright centerleftright_labels


eststo M1_force: regress shiftw6w7_LR i.labourind_force6, robust

eststo M2_force: regress shiftw6w7_LR i.labourind_force6##i.centerleftright, robust
margins, at(centerleftright=(0 1 2) labourind_force6=(0)) post
estimates store independent

regress shiftw6w7_LR i.labourind_force6##i.centerleftright, robust
margins, at(centerleftright=(0 1 2) labourind_force6=(1)) post
estimates store weak

regress shiftw6w7_LR i.labourind_force6##i.centerleftright, robust
margins, at(centerleftright=(0 1 2) labourind_force6=(2)) post
estimates store strong

esttab M1_force M2_force using "${tables}/Table12_1.tex" , b(3) se(3) nogap replace



coefplot independent weak strong , horizontal yline(0) title("change in left-right between wave 6 and wave 7") xline(0, lpattern(dash)) ylabel(1 "center" 2 "left-wing" 3 "right-wing", angle(0)) 
graph save "${figures}/Figure12_1.gph", replace 








* FIGURE 12.2: Evolution of left-right placement among weak and strong Labour identifiers


* Create a new folder in the data folder that is named "estimates"

cd "$data"
use "panel.dta", clear 

xtset id vague 

******* weak Labour  
cd "$data/estimates"

eststo m1: xtreg leftRightW i.vague if pid6==2 & Labourforce6==1, fe
margins, at(vague=(1 2 3 4 5 6 7 8 9 10 11 12 15 16 17 18 19 20 21 22 23)) saving(results19, replace)

use results19.dta, clear

gen categories = 1 // weak labour partisans 

save results19.dta, replace 


******* strong Labour 

cd "$data"
use "panel.dta", clear 
cd "$data/estimates"
xtset id vague 

eststo m1: xtreg leftRightW i.vague if pid6==2 & Labourforce6==2, fe
margins, at(vague=(1 2 3 4 5 6 7 8 9 10 11 12 15 16 17 18 19 20 21 22 23)) saving(results20, replace)

use results20.dta, clear

gen categories = 2 // strong labour partisans 

save results20.dta, replace 

 
*now append these datasets 
 
cd "$data/estimates"
use "results19.dta", clear 
append using "results20.dta"

drop _deriv _term _predict _se_margin _statistic _pvalue 

rename _margin b
rename _ci_lb b_lower 
rename _ci_ub b_upper 
rename _at vague_updated // note that wave 1, 13, 14 and 19 are not available. Margins command will jump those and will not show them, the outcome will be as if there is no gaps from 1 to the last, hence use "_at1" variable. 


rename categories category

tsset category _at1 
 
twoway (tsline b if category==1, lcolor(cranberry%60) lpattern(dash)) (tsline b_lower if category==1, lcolor(cranberry%60) lpattern(solid)) (tsline b_upper if category==1, lcolor(cranberry%60)) (tsline b if category==2, lcolor(cranberry%100) lpattern(dash)) (tsline b_lower if category==2, lcolor(cranberry%100) lpattern(solid)) (tsline b_upper if category==2, lcolor(cranberry%100) lpattern(solid)), legend(off) xline(6.5, lpattern(solid) lcolor(gs6%70)) tlabel(#30, labels labsize(vsmall) angle(vertical) valuelabel) ttitle("") graphregion(margin(5 5 15 5)) title("") yscale(range(2(0.5)4)) ytick(2 2.5 3 3.5 4) ylabel(2 2.5 3 3.5 4)  
graph save "${figures}/Figure12_2.gph",replace 




















